package cn.yunhe.model;

import javax.persistence.*;
import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

/*hibernate注解*/
@Entity(name = "区县")
@Table(name = "district")
public class District implements Serializable {
    private int did;
    private String dname;
    private Set<Street>streetSet=new HashSet<>();

    public District() {
    }

    public District(String dname) {
        this.dname = dname;
    }

    public District(int did, String dname) {
        this.did = did;
        this.dname = dname;
    }

    @Id
    @GeneratedValue
    @Column(name = "did")
    public int getDid() {
        return did;
    }

    public void setDid(int did) {
        this.did = did;
    }

    @Column(name = "dname")
    public String getDname() {
        return dname;
    }

    public void setDname(String dname) {
        this.dname = dname;
    }

    @OneToMany(cascade = CascadeType.ALL,fetch = FetchType.LAZY)
    @JoinColumn(name = "sdid")
    public Set<Street> getStreetSet() {
        return streetSet;
    }

    public void setStreetSet(Set<Street> streetSet) {
        this.streetSet = streetSet;
    }
}
